package model_;
import java.util.*;

public class PersonList {
	private List<Person> thelist = new LinkedList<Person>();
	private int i = 0;
	public void add(Person a){
		thelist.add(i, a);
		i++;
	}
	public void clear_(){
		thelist.clear();
	}
	public void remove(int index){
		thelist.remove(index);
	}
	public void remove(int fromIndex, int toIndex){
		if(!thelist.isEmpty())
			thelist.removeAll(thelist.subList(fromIndex, toIndex));
	}
	public void set(int index, Person element) {
		thelist.set(index, element);
	}
	public void contains_(Person o){
		thelist.contains(o);
	}
	public void getsize(){
		thelist.size();
	}
	public void print(){
			//thelist.iterator();
			for(int i = 0;i<thelist.size();i++)
				System.out.printf("%s	", thelist.get(i));
			System.out.println();
	}
	public String toString() {
		String string = "[";
		System.out.println("LinkedList contains : ");
	    for(int i=0; i< thelist.size(); i++)
	    {
	      System.out.println(thelist.get(i));
	    }
	    for(int i=0; i< thelist.size(); i++){
	    	string = string + thelist.get(i) + ", ";
	    }
	    string += "]";
	    return string;
	}
}
	
	
	
	
